/*
 * Copyright (C) 2021 Fastjrun, Inc. All Rights Reserved.
 */
package com.fastjrun.bms.helper;

import com.fastjrun.bms.dto.BookDTO;
import com.fastjrun.bms.dto.PressDTO;
import com.fastjrun.bms.dto.UserDTO;
import com.fastjrun.bms.entity.Book;
import com.fastjrun.bms.entity.Press;
import com.fastjrun.bms.entity.SysUser;
import com.fastjrun.bms.vo.BookVO;

public class DTOToEntifyConverter {
    public static final SysUser convert(UserDTO userDTO) {
        SysUser sysUser = new SysUser();
        sysUser.setIsAccountNonExpired(userDTO.getIsAccountNonExpired());
        sysUser.setIsCredentialsNonExpired(userDTO.getIsCredentialsNonExpired());
        sysUser.setNickName(userDTO.getNickName());
        sysUser.setIsEnabled(userDTO.getIsEnabled());
        sysUser.setMobile(userDTO.getMobile());
        sysUser.setIsAccountNonLocked(userDTO.getIsAccountNonLocked());
        sysUser.setId(userDTO.getId());
        sysUser.setEmail(userDTO.getEmail());
        sysUser.setUsername(userDTO.getUsername());
        return sysUser;

    }


    public static final Press convert(PressDTO pressDTO) {
        Press press=new Press();
        press.setId(pressDTO.getId());
        press.setName(pressDTO.getName());
        return press;
    }


    public static final Book convert(BookDTO bookDTO) {
        Book book = new Book();
        book.setId(bookDTO.getId());
        book.setName(bookDTO.getName());
        book.setIsbn(bookDTO.getIsbn());
        book.setAuthor(bookDTO.getAuthor());
        book.setPrice(bookDTO.getPrice());
        book.setProfile("");
        book.setPressId(bookDTO.getPressId());
        return book;
    }
}
